package com.yy.jhl.ui.manager.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.yy.common.base.BaseActivity;
import com.yy.common.commonutils.StringUtil;
import com.yy.common.commonwidget.OnNoDoubleClickListener;
import com.yy.jhl.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 备注
 * Created by libingn on 2017/12/7.
 */

public class NoteActivity extends BaseActivity {
    public static final String EXTRA_NOTE_SUCCESS = "EXTRA_NOTE_SUCCESS";
    @BindView(R.id.note_edit)
    EditText noteEdit;
    @BindView(R.id.ensure_btn)
    Button ensureBtn;

    public static void startAction(Context mContext) {
        Intent intent = new Intent(mContext, NoteActivity.class);
        mContext.startActivity(intent);
    }

    @Override
    public int getLayoutId() {
        return R.layout.act_note;
    }

    @Override
    public void initView() {
        showTitle("备注", new OnNoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                finish();
            }
        });
    }

    @OnClick(R.id.ensure_btn)
    public void onViewClicked() {
        String result = noteEdit.getText().toString().trim();
        if (StringUtil.isEmpty(result)){
            showShortToast("备注信息不能为空");
            return;
        }
        Intent intent = new Intent();
        intent.putExtra(EXTRA_NOTE_SUCCESS, result);
        setResult(RESULT_OK, intent);
        finish();
    }
}
